///////////////////////////////////////////////////////////////////////////
//
// Spring Engine Source File.
// Copyright (C), Dengtao 2011-2021
// ----------------------------------------------------------------------
// File name:   SfGameObjectGUID.h
// Version:     v1.0.0
// Created:     2013/06/15 23:11 by dengtao
// Compilers:   Visual Studio 2008
// Description: 
// ----------------------------------------------------------------------
// History:
//
///////////////////////////////////////////////////////////////////////////

#ifndef _SfGameObjectGUID_H_
#define _SfGameObjectGUID_H_

#include "SfBaseDefines.h"
#include "SfMemoryObject.h"

namespace Sunflower
{
//////////////////////////////////////////////////////////////////////////
//Summary:
//	game object guid.
//////////////////////////////////////////////////////////////////////////
class GameObjectGUID : public MemoryObject
{
	friend class GameObjectManager;

protected:
	enum
	{
		InvalidIntID = 0,
	};

public:
	static const GameObjectGUID InvalidGoid;

public:
	//
	//Summary:
	//	constructor.
	GameObjectGUID(unsigned int intID)
		: m_IntID(intID)
	{
	}

protected:
	//
	//Summary:
	//	set intid
	void SetIntID(unsigned int id)
	{
		m_IntID = id;
	}

	unsigned int GetIntID() const
	{
		return m_IntID;
	}

public:
	//
	//Summary:
	//	GameObjectGUID
	GameObjectGUID() : m_IntID(InvalidIntID) {}

	//
	//Summary:
	//	returns true if the GameObjectGUID is valid id.
	bool IsValidGoid() const
	{
		return m_IntID != InvalidIntID;
	}

	//
	//Summary:
	//	destructor.
	~GameObjectGUID(){}

	//
	//Summary:
	//	operator == !=
	bool operator ==(const GameObjectGUID& other) const
	{
		return m_IntID == other.m_IntID;
	}

	bool operator !=(const GameObjectGUID& other) const
	{
		return m_IntID != other.m_IntID;
	}

	//
	//Summary:
	//	operator >,>=,<,<=
	bool operator >(const GameObjectGUID& other) const
	{
		return m_IntID > other.m_IntID;
	}

	bool operator >=(const GameObjectGUID& other) const
	{
		return m_IntID >= other.m_IntID;
	}

	bool operator <(const GameObjectGUID& other) const
	{
		return m_IntID < other.m_IntID;
	}

	bool operator <=(const GameObjectGUID& other) const
	{
		return m_IntID >= other.m_IntID;
	}

public:
	GameObjectGUID(const GameObjectGUID& other)
	{
		m_IntID = other.m_IntID;
	}

	GameObjectGUID& operator =(const GameObjectGUID& other)
	{
		m_IntID = other.m_IntID;
		return *this;
	}

private:
	unsigned int m_IntID;
};

}

#endif
